package com.atguigu.tingshu.user.factory.impl;

import com.atguigu.tingshu.user.factory.PurchaseStrategyFactory;
import com.atguigu.tingshu.user.strategy.PurchaseStrategy;
import com.atguigu.tingshu.user.strategy.impl.AlbumPurchaseStrategy;
import com.atguigu.tingshu.user.strategy.impl.TrackPurchaseStrategy;
import com.atguigu.tingshu.user.strategy.impl.VipPurchaseStrategy;
import jakarta.annotation.PostConstruct;
import jakarta.annotation.Resource;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

/**
 * ClassName: PurchaseStrategyFactoryImpl
 * Package: com.atguigu.tingshu.user.factory.impl
 * Description:
 *
 * @Author:
 * @Create: 2025/8/10 - 0:03
 * @Version: v1.0
 */
@Service
public class PurchaseStrategyFactoryImpl implements PurchaseStrategyFactory {

    @Resource
    private AlbumPurchaseStrategy albumPurchaseStrategy;

    @Resource
    private TrackPurchaseStrategy trackPurchaseStrategy;

    @Resource
    private VipPurchaseStrategy vipPurchaseStrategy;

    @Resource
    Map<String,PurchaseStrategy> map = new HashMap<>();


    @Override
    public PurchaseStrategy getStrategy(String itemType) {
        return map.get(itemType);
    }
}
